package book;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: XMQ
 * Date: 2022-05-26
 * Time: 8:48
 */
public class BookList {
    //书架
    private Book[] books = new Book[10]; //10本
    private int usedSize; //实时记录现在有几本书

    public BookList() {
        books[0] = new Book("三体","刘慈欣","中国","科幻小说");
        books[1] = new Book("老人与海","海明威","美国","短篇小说");
        books[2] = new Book("你的名字","新海诚","日本","电影快讯");

        usedSize = 3;
    }

    //根据下标取一本书
    public Book getBook(int pos){
        return books[pos];
    }
    //添加一本书进书架
    public void setBook(int pos, Book book){
        books[pos] = book;
    }
    //了解现在有多少书
    public int getUsedSize(){
        return usedSize;
    }
    //修改书籍数量
    public void setUsedSize(int pos){
        this.usedSize += pos;
    }
}
